package br.usjt.lab.hirose;

import java.awt.Graphics;
import br.usjt.lab.hirose.PtCartesiano;

/**
 * @author Edivan Dias
 */
public class Triangulo {
	PtCartesiano p1a;
	PtCartesiano p2a;
	PtCartesiano p3a;
	PtCartesiano pAux;
	
	public Triangulo() {
		p1a = new PtCartesiano(0, 0);
		p2a = new PtCartesiano(32.5, 65);
		p3a = new PtCartesiano(65, 0);
	}
	
	public PtCartesiano getPtCartesiano(PtCartesiano t){
		return t;
	}

	public void desenharTriangulo(double x1, double y1, double x2, double y2, double x3, double y3, Graphics g) {
		p1a.x = x1;
		p1a.y = y1;
		p2a.x = x2;
		p2a.y = y2;
		p3a.x = x3;
		p3a.y = y3;

		PtCartesiano p1 = new PtCartesiano(p1a.x, p1a.y);
		PtCartesiano p2 = new PtCartesiano(p2a.x, p2a.y);
		PtCartesiano p3 = new PtCartesiano(p3a.x, p3a.y);

		p1.retaDDA(p2, g);
		p2.retaDDA(p3, g);
		p3.retaDDA(p1, g);
	}
	public void desenharTriangulo(PtCartesiano p, Graphics g){
		int i = 1;
		PtCartesiano aux = p;
		System.out.println("p.x["+i+"]y["+i+"] = ["+aux.x+"]["+aux.y+"]");
		i++;
		aux.retaDDA(aux.link, g);

		do{
			aux = aux.link;
			System.out.println("p.x["+i+"]y["+i+"] = ["+aux.x+"]["+aux.y+"]");
			i++;
			aux.retaDDA(aux.link, g);
		}while(aux.link != p);
	}
	
	public static void main(String[] args) {

	}
}
